package com.jifeng.sterilizer.service.impl;

import com.jifeng.sterilizer.utils.PageUtils;
import com.jifeng.sterilizer.utils.Query;
import com.jifeng.sterilizer.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.jifeng.sterilizer.dao.VwFarmUserDao;
import com.jifeng.sterilizer.entity.VwFarmUserEntity;
import com.jifeng.sterilizer.service.VwFarmUserService;


@Service("vwFarmUserService")
@Slf4j
public class VwFarmUserServiceImpl extends ServiceImpl<VwFarmUserDao, VwFarmUserEntity> implements VwFarmUserService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        try{
        QueryWrapper<VwFarmUserEntity> queryWrapper = new QueryWrapper<>();
        Object farm = params.get("farm");
        if (farm != null && !farm.equals("")) {
            queryWrapper.eq("farm", farm);
        }
        IPage<VwFarmUserEntity> page = this.page(
                new Query<VwFarmUserEntity>().getPage(params),
                queryWrapper
        );
        return new PageUtils(page);
        }catch(Exception e){
            e.printStackTrace();
            log.error("方法：{}，错误信息：{}", "农场账号列表 PC", e.getMessage());
            return null;
        }
    }

}